package cn.edu.sjtu.stap.cg;

import org.aspectj.ajdt.internal.compiler.ast.*;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.*;

public class CgAdvice extends CgMethod {
    private static final long serialVersionUID = 1L;

    public CgAdvice() {
        super();
    }

    public void setASTNode(ASTNode node) {
        if (node instanceof AdviceDeclaration) {
            super.setASTNode(node);
        } else {
            throw new IllegalArgumentException("Uncompatiable AST node!");
        }
    }

    public String getAdviceName() {
        return getMethodName();
    }

    public String toString() {
        StringBuffer b = new StringBuffer();

        b.append("(Node Id: ");
        b.append(this.getId());
        b.append(", Advice Name: ");
        b.append(this.getAdviceName());
        b.append(")");

        return b.toString();
    }
}
